<template>
  <a-card :bordered="false">
    <search-form :showSuperButton="false" exportFileName="出入库记录" :showAddButton="false">
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item label="工单号">
          <a-input allowClear placeholder="请输入工单号" v-model="queryParam.moNum"></a-input>
        </a-form-item>
      </a-col>
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item label="客户代码">
          <a-input allowClear placeholder="请输入客户代码" v-model="queryParam.custCode"></a-input>
        </a-form-item>
      </a-col>
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item label="图号">
          <a-input allowClear placeholder="请输入图号" v-model="queryParam.dwgNo"></a-input>
        </a-form-item>
      </a-col>
      <a-col :xl="4" :lg="7" :md="8" :sm="24">
        <a-form-item label="版本">
          <a-input allowClear placeholder="请输入版本" v-model="queryParam.rev"></a-input>
        </a-form-item>
      </a-col>
    </search-form>

    <div class="fivs-all-box">
      <div class="fivs-all-contain">
        <fmsx-table
          ref="table"
          :scroll="{ x: true }"
          :columns="columns"
          :data-source="dataSource"
          :loading="loading"
          :bordered="false"
          :pagination="ipagination"
          rowKey="id"
          class="j-table-force-nowrap fivs-all-reset"
          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
          @change="handleTableChange"
        >
        </fmsx-table>
      </div>
    </div>
  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'WarehousingList',
  desc: '入库记录',
  mixins: [JeecgListMixin],
  props: {
    type: {
      type: Number,
      default: 0
    }
  },
  data () {
    const type = this.type
    return {
      queryParam: {
        type: type
      },
      url: {
        list: '/prod-pre/make/makeRecord/list',
        exportXlsUrl: '/prod-pre/make/makeRecord/exportXls'
      },
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '工单号',
          align: 'center',
          dataIndex: 'moNum'
        },
        {
          title: '客户代码',
          align: 'center',
          dataIndex: 'custCode'
        },
        {
          title: '图号',
          align: 'center',
          dataIndex: 'dwgNo',
          customRender: (text, row, index) => {
            if (text && text.length > 0) {
              //let url = window._CONFIG['domianURL'] + '/base/annex/file/download/' + userpath
              let url = '/#/mes/other/pdf?drawNum=' + row.dwgNo + '&drawRev=' + row.rev
              return (
                <a href={url} target='_blank'>
                  {text}
                </a>
              )
            }
          }
        },
        {
          title: '版本',
          align: 'center',
          dataIndex: 'rev'
        },
        {
          title: '工序号',
          align: 'center',
          dataIndex: 'operationNum'
        },
        {
          title: '工序编码',
          align: 'center',
          dataIndex: 'processId'
        },
        {
          title: '生产数量',
          align: 'center',
          dataIndex: 'productionQuantity'
        },
        {
          title: '入库数量',
          align: 'center',
          dataIndex: 'quantity'
        },
        {
          title: '仓库',
          align: 'center',
          dataIndex: 'wmsId_dictText'
        },
        {
          title: '货架',
          align: 'center',
          dataIndex: 'shelvesId_dictText'
        },
        {
          title: '储位',
          align: 'center',
          dataIndex: 'storageId_dictText'
        },
        {
          title: '申请人',
          align: 'center',
          dataIndex: 'recordBy'
        },
        {
          title: '申请时间',
          align: 'center',
          dataIndex: 'recordTime'
        },

        {
          title: '操作人',
          align: 'center',
          width: 80,
          dataIndex: 'updateBy'
        },
        {
          title: '操作时间',
          align: 'center',
          width: 150,
          dataIndex: 'updateTime'
        }
      ]
    }
  }
}
</script>
<style lang="less" scoped></style>
